<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
.box {
  width: 300px;
  height: 300px;
  border: 1px solid #000;
}
.pink {
  background-color: pink;
}
.bigsize {
  font-size: 30px;
}
.a {
  color: green
}
</style>
<body>
    <div id="app">
      <!-- :class="{类名1: 布尔值}" -->
      <h3>动态绑定类名</h3>
      <!-- <div class="box" :class="{pink: false, bigsize: true}">
        我是个盒子
      </div> -->
      <!-- :class="[类名1,类名2]" -->
      <div class="box" :class="arr">
        我是个盒子
      </div>
      <button @click="addClass">加类名</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          arr: ['pink','bigsize']
        },
        methods: {
          addClass() {
            this.arr.push('a')
          }
        }
      })
    </script>
</body>
</html>